<!DOCTYPE html>
<html>
  <head>
    <title>wpcom.js browser example with iframe proxy</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <script src="../../dist/wpcom.js"></script>
    <script src="http://wzrd.in/standalone/wpcom-proxy-request@1.0.x"></script>
    <script>
      var wpcom = WPCOM();

      // have this `wpcom` instance use the `wpcom-proxy-request`
      // function for API requests
      wpcom.request = wpcomProxyRequest;

      // upgrade to "access all users blogs" mode
      wpcom.request({
        metaAPI: { accessAllUsersBlogs: true }
      }, function(err) {
        if (err) throw err;
        console.log('proxy now running in "access all user\'s blogs" mode');
      });

      // get information about the currently logged in user (via cookie)
      wpcom.req.get('/me', function(err, me){
        if (err) throw err;
        console.log(me);

        var d = document.createElement('pre');
        d.innerHTML = JSON.stringify(me, null, 2);
        document.body.appendChild(d);
      });
    </script>
  </body>
</html>
